package com.battery.system.service.battery.impl;

import java.util.List;

import com.battery.common.utils.DateUtils;
import com.battery.system.domain.BO.DevApplyBO;
import com.battery.system.domain.VO.DevApplyVO;
import com.battery.system.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.battery.system.mapper.DevApplyMapper;
import com.battery.system.domain.DevApply;
import com.battery.system.service.battery.IDevApplyService;
import com.battery.common.core.text.Convert;

/**
 * 设备申领Service业务层处理
 *
 * @author battery
 * @date 2021-01-22
 */
@Service
public class DevApplyServiceImpl extends BaseServiceImpl<DevApply> implements IDevApplyService {
    @Autowired
    private DevApplyMapper devApplyMapper;

    /**
     * 查询设备申领
     *
     * @param id 设备申领ID
     * @return 设备申领
     */
    @Override
    public DevApply selectDevApplyById(String id) {
        return devApplyMapper.selectDevApplyById(id);
    }

    /**
     * 查询设备申领列表
     *
     * @param devApply 设备申领
     * @return 设备申领
     */
    @Override
    public List<DevApply> selectDevApplyList(DevApply devApply) {
        return devApplyMapper.selectDevApplyList(devApply);
    }

    /**
     * 新增设备申领
     *
     * @param devApply 设备申领
     * @return 结果
     */
    @Override
    public int insertDevApply(DevApply devApply) {
        devApply.setCreateTime(DateUtils.getNowDate());
        return devApplyMapper.insertDevApply(devApply);
    }

    /**
     * 修改设备申领
     *
     * @param devApply 设备申领
     * @return 结果
     */
    @Override
    public int updateDevApply(DevApply devApply) {
        devApply.setUpdateTime(DateUtils.getNowDate());
        return devApplyMapper.updateDevApply(devApply);
    }

    /**
     * 删除设备申领对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteDevApplyByIds(String ids) {
        return devApplyMapper.deleteDevApplyByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除设备申领信息
     *
     * @param id 设备申领ID
     * @return 结果
     */
    @Override
    public int deleteDevApplyById(String id) {
        return devApplyMapper.deleteDevApplyById(id);
    }

    /**
     * 展示设备申领列表
     *
     * @param devApplyBO
     * @return
     */
    @Override
    public List<DevApplyVO> selectDevApplyVOList(DevApplyBO devApplyBO) {
        return devApplyMapper.selectDevApplyVOList(devApplyBO);
    }


    @Override
    public DevApplyVO selectDevApplyVOById(String id) {
        return devApplyMapper.selectDevApplyVOById(id);
    }
}
